import MyComponent from "../../common/MyComponent";
import { GameConst } from "../../constant/GameConst";
import { WAIT_EVENTS } from "../../GuideSystem/GuideMapping";

const { ccclass, property, menu } = cc._decorator;

@ccclass
@menu("测试组件/TestWinOne")
export default class TestWinOne extends MyComponent {
  constructor() {
    super();
    this.winType = GameConst.WIN_TYPE.POPUP;
  }

  show(data: any) {
    this.onOpenAnimationFinished();
  }

  protected onDisable(): void {
    // 通知引导系统：B 已关闭
    cc.systemEvent.emit(WAIT_EVENTS.guide_step_6, WAIT_EVENTS.guide_step_6);
  }

  //===================按钮回调===================
  protected onClickBtnStep1() {
    console.log("引导步骤1");
  }
  protected onClickBtnStep2() {
    console.log("引导步骤2");
  }
  protected onClickBtnStep3() {
    console.log("引导步骤3");
  }

  onOpenAnimationFinished() {
    console.log("B 界面打开完成");
    // 通知引导系统：B 已就绪
    cc.systemEvent.emit(WAIT_EVENTS.guide_step_2, WAIT_EVENTS.guide_step_2);
  }

  onClickBtnClose() {
    this.close(); // 执行关闭逻辑
  }
}
